Skip to content

feat(core): support localhosting setting api link and key in connect#33103

Open
mohamed-em2m wants to merge 4 commits into
anomalyco:devfrom
mohamed-em2m:connect-localhost
Open

feat(core): support localhosting setting api link and key in connect#33103
mohamed-em2m wants to merge 4 commits into
anomalyco:devfrom
mohamed-em2m:connect-localhost

Conversation

@mohamed-em2m

Copy link
Copy Markdown

Issue for this PR

Closes #

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds support for setting a custom API link (baseURL) and API key for local LLM providers (like Ollama, LM Studio, Llama.cpp, etc.) directly in the /connect command interface:

  • TUI Updates: Added a "Localhost" option preset in the connect dialog options. It triggers a multi-step setup prompt to select the local provider, configure its API endpoint URL, and optionally enter an API key. This saves credentials with the custom URL stored inside metadata.
  • Provider Resolution: Updated the core provider loading logic to read the baseURL property from the provider's auth.metadata when resolving API key credentials, enabling custom base URL configuration without editing opencode.json.

How did you verify your code works?

  • Added a dedicated unit test provider loaded from auth metadata with baseURL in packages/opencode/test/provider/provider.test.ts.
  • Verified using npx bun typecheck and ran all provider tests successfully (89 pass, 0 failures).
  • Verified manually that selecting "Localhost" in /connect saves the endpoint and key correctly to the auth database.

Screenshots / recordings

image image image image image

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found potentially related PRs:

Related PRs:

  1. feat(opencode): local LAN provider discovery + auto-discover models (feat(opencode): local LAN provider discovery + auto-discover models #27554)

    • Related because it also deals with local provider discovery and configuration
  2. feat(opencode): auto-discover models from OpenAI-compatible providers (feat(opencode): auto-discover models from OpenAI-compatible providers #32731)

    • Related as it handles OpenAI-compatible provider configuration, which is relevant to the baseURL and API key setup for local providers like Ollama and LM Studio

These PRs may overlap in scope regarding local provider setup and configuration, though they appear to focus on different aspects (discovery/auto-discovery vs. manual configuration in the connect command).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant